package com.fenyin.samples.study.jvm.gc;  
/**
 * VM args:-verbose:gc -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8
 *@Description:优先在Eden分配对象例子  
 *@Author:fengzhichao  
 *@Since:2012-8-25  
 *@Version:1.1.0
 */
public class EdenAllocation {
	
	private static int _1MB = 1024*1024;
	
	public static void main(String[] args){
		byte[] allocation1 = new byte[2*_1MB];
		byte[] allocation2 = new byte[2*_1MB];
		byte[] allocation3 = new byte[2*_1MB];
		byte[] allocation4 = new byte[4*_1MB];
		
//		allocation1
//		Heap
//		 def new generation   total 9216K, used 2555K [0x326f0000, 0x330f0000, 0x330f0000)
//		  eden space 8192K,  31% used [0x326f0000, 0x3296ef00, 0x32ef0000)
//		  from space 1024K,   0% used [0x32ef0000, 0x32ef0000, 0x32ff0000)
//		  to   space 1024K,   0% used [0x32ff0000, 0x32ff0000, 0x330f0000)
//		 tenured generation   total 10240K, used 0K [0x330f0000, 0x33af0000, 0x33af0000)
//		   the space 10240K,   0% used [0x330f0000, 0x330f0000, 0x330f0200, 0x33af0000)
//		 compacting perm gen  total 12288K, used 372K [0x33af0000, 0x346f0000, 0x37af0000)
//		   the space 12288K,   3% used [0x33af0000, 0x33b4d0c0, 0x33b4d200, 0x346f0000)
//		    ro space 10240K,  54% used [0x37af0000, 0x3806c510, 0x3806c600, 0x384f0000)
//		    rw space 12288K,  55% used [0x384f0000, 0x38b8fb78, 0x38b8fc00, 0x390f0000)
		
//		allocation2
//		Heap
//		 def new generation   total 9216K, used 4603K [0x326f0000, 0x330f0000, 0x330f0000)
//		  eden space 8192K,  56% used [0x326f0000, 0x32b6ef10, 0x32ef0000)
//		  from space 1024K,   0% used [0x32ef0000, 0x32ef0000, 0x32ff0000)
//		  to   space 1024K,   0% used [0x32ff0000, 0x32ff0000, 0x330f0000)
//		 tenured generation   total 10240K, used 0K [0x330f0000, 0x33af0000, 0x33af0000)
//		   the space 10240K,   0% used [0x330f0000, 0x330f0000, 0x330f0200, 0x33af0000)
//		 compacting perm gen  total 12288K, used 372K [0x33af0000, 0x346f0000, 0x37af0000)
//		   the space 12288K,   3% used [0x33af0000, 0x33b4d0f8, 0x33b4d200, 0x346f0000)
//		    ro space 10240K,  54% used [0x37af0000, 0x3806c510, 0x3806c600, 0x384f0000)
//		    rw space 12288K,  55% used [0x384f0000, 0x38b8fb78, 0x38b8fc00, 0x390f0000)
	
//		allocation3
//		Heap
//		 def new generation   total 9216K, used 6651K [0x326f0000, 0x330f0000, 0x330f0000)
//		  eden space 8192K,  81% used [0x326f0000, 0x32d6ef20, 0x32ef0000)
//		  from space 1024K,   0% used [0x32ef0000, 0x32ef0000, 0x32ff0000)
//		  to   space 1024K,   0% used [0x32ff0000, 0x32ff0000, 0x330f0000)
//		 tenured generation   total 10240K, used 0K [0x330f0000, 0x33af0000, 0x33af0000)
//		   the space 10240K,   0% used [0x330f0000, 0x330f0000, 0x330f0200, 0x33af0000)
//		 compacting perm gen  total 12288K, used 372K [0x33af0000, 0x346f0000, 0x37af0000)
//		   the space 12288K,   3% used [0x33af0000, 0x33b4d130, 0x33b4d200, 0x346f0000)
//		    ro space 10240K,  54% used [0x37af0000, 0x3806c510, 0x3806c600, 0x384f0000)
//		    rw space 12288K,  55% used [0x384f0000, 0x38b8fb78, 0x38b8fc00, 0x390f0000)
	 
//	    allocation4
//		[GC [DefNew: 6487K->154K(9216K), 0.0055583 secs] 6487K->6298K(19456K), 0.0055948 secs] [Times: user=0.02 sys=0.00, real=0.02 secs] 
//		新生代
//		Heap
//		 def new generation   total 9216K, used 4414K [0x326f0000, 0x330f0000, 0x330f0000)
//		  eden space 8192K,  52% used [0x326f0000, 0x32b18fe0, 0x32ef0000)
//		  from space 1024K,  15% used [0x32ff0000, 0x33016a10, 0x330f0000)
//		  to   space 1024K,   0% used [0x32ef0000, 0x32ef0000, 0x32ff0000)
//		 tenured generation   total 10240K, used 6144K [0x330f0000, 0x33af0000, 0x33af0000)
//		   the space 10240K,  60% used [0x330f0000, 0x336f0030, 0x336f0200, 0x33af0000)
//		 compacting perm gen  total 12288K, used 372K [0x33af0000, 0x346f0000, 0x37af0000)
//		   the space 12288K,   3% used [0x33af0000, 0x33b4d160, 0x33b4d200, 0x346f0000)
//		    ro space 10240K,  54% used [0x37af0000, 0x3806c510, 0x3806c600, 0x384f0000)
//		    rw space 12288K,  55% used [0x384f0000, 0x38b8fb78, 0x38b8fc00, 0x390f0000)
	}
}
